﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Shanfree.Framework.Utility;
using Shanfree.SharpMovie.BLL;
using Shanfree.SharpMovie.Model;

public partial class List_Theme : BasePage
{
    const string CATALOG_ACT = "5";
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                BindList();
            }
        }
        catch (Exception ex)
        {
            ShowMsg(ex.Message);
            LogEntry.Log.Write(ex.ToString());
        }
    }

    private void BindList()
    {
        // 演员分类下的所有子类别
        IList<CatalogInfo> cList = new Catalog().GetSubList(CATALOG_ACT);
        dlCatalog.DataSource = cList;
        dlCatalog.DataBind();
    }

    protected void dlCatalog_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
             e.Item.ItemType == ListItemType.AlternatingItem)
        {
            int pageSize = 30;
            int pageIndex = 0;
            CatalogInfo cInfo = e.Item.DataItem as CatalogInfo;
            IList<ListInfo> lInfo = new List().GetListByCatalogID(cInfo.ID, false, pageSize, pageIndex);
            DataList dlSub = e.Item.FindControl("dlSub") as DataList;
            dlSub.DataSource = lInfo;
            dlSub.DataBind();
        }
    }
}
